/*DESCRIPTION:
I wrote this about a year ago  but I think I figured it out again.  The first of
everything is 0, if you want the first card in a hand or in the deck, it's 0.  There is
one exception to this.  The first hand is 1.  If you want to change anything or fix anything
go ahead.

This is a self-contained deck of cards, you can't put cards into it or take any out;
all the hands are within it; you declare them.  This way you won't accidently create extra
cards.  You can declare your own Cards outside and make copies of the cards in the hands or
whatever.  I'm not sure if everything works right; I don't think I've used every funtion.  This
version is changed once in Deck.cpp and once in Cardstack.cpp to get rid of the A's and K's

Eric Norton*/

//deck.h
//by Eric Norton
//2/13/02

#ifndef DECK_H
#define DECK_H

#include "cardstack.h"	//contains Cardstack lists

//this class contains a main Cardstack (the deck) and
//a user specified number of sub-cardstacks (hands, discard pile)
class Deck
{
public:
	//PRECONDITION: none
	//POSTCONDITION: srand() is seeded, private variables initialized
	Deck();
	//PRE: none
	//POST: Fulldeck and all hands freed from memory
	void Zapdeck();
	//PRE: expects integer
	//POST: if newsize is within bounds, Zapdeck() is called and Deck
	//of inewsize decks is generated [Sizeit(1) makes a 52 card deck]
	bool Sizeit(int inewsize);
	//PRE: none
	//POST: Fulldeck is output to screen
	void Printdeck();
	//PRE: expects integer
	//POST: all drawn Cards are returned to Fulldeck, new inum hands
	//are allocated
	bool Handgen(int inum);
	//PRE: expects integers ihand and iCard
	//POST: iCardth Card is drawn from Fulldeck and put in tail
	//of ihandth hand
	bool Draw(int ihand, int iCard);
	//PRE: expects ihand
	//POST: ihandth hand is output to screen
	bool Printhand(int ihand);
	//PRE: none
	//POST: if no cards are drawn, Fulldeck is shuffled
	bool Shuffle();
	//PRE: expects ihand and iCard
	//POST: iCardth Card of ihandth hand is returned to Fulldeck
	bool Discard(int ihand, int iCard);
	//PRE: none
	//POST: all Cards returned to Fulldeck
	void Fulldiscard();
	//PRE: expects donor hand and Card, recipient hand, and whether
	//to put Card on head or tail
	//POST: if valid, Card is taken from idonorth hand and given to
	//thiefth hand
	bool Handgive(int idonor, int iCard, int ithief, bool bhead);
	//PRE: none
	//POST: inumth Card of Fulldeck is returned
	Card Getdeckcard(int inum);
	//PRE: none
	//POST: inumth Card of ihandth hand is returned
	Card Gethandcard(int ihand, int inum);
	//PRE: none
	//POST: returns isize of Fulldeck
	int Getsize();
	//PRE: none
	//POST: returns size of ihandth hand
	int Gethandsize(int ihand);
	//PRE: none
	//POST: Zapdeck() is called
	~Deck();
private:
	Cardstack Fulldeck;		//this IS the deck
	Cardstack* rgCShands;	//hands that draw from Fulldeck
	int idrawn;				//total #of Cards missing from Fulldeck
	int inumhands;			//user specified #of hands
};

#endif